<?php

declare(strict_types=1);

namespace app\admin\validate\auth;

use sheep\validate\Backend;

class Access extends Backend
{
    protected $rule = [
        'title' => 'require|chsDash|length:2,10',
        'type' => 'require|in:menu,page,modal,api',
        'name' => 'require|unique:access',
        'api' => 'array'
    ];

    protected $message  =   [
        'title.require'     => '菜单名称必须填写',
        'title.chsDash'     => '菜单名称只能是汉字、字母、数字和下划线_及破折号-',
        'title.length'     => '菜单名称必须在 2-10 位',
        'type.require'     => '菜单类型必须选择',
        'type.in'     => '菜单类型选择不正确',
        'name.require'     => '权限标识必须填写',
        'name.unique'     => '权限标识不能重复',
        'api.array'     => '子权限格式不正确',
    ];


    protected $scene = [
        'add'  =>  ['title', 'type', 'name', 'api'],
    ];
}
